<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // const obj = {
    //   name: "zhangsan",
    //   age: 20,
    //   num: 1,
    //   likes: ["eat", "sleep"]
    // }
    // 对象最常见的遍历用for..in..
    // 可以得到每一项的key
    // for (const key in obj) {
    //   console.log(key);
    //   console.log(obj[key]);
    // }




    // 数组可以使用for..of..循环
    // const arr = ["a", "b", "c", "d"]
    // for (const item of arr) {
    //   console.log(item);
    // }





    // 可以用Object.keys() / Object.values() / Object.entries()将对象转成数组
    // const obj = {
    //   name: "zhangsan",
    //   age: 20,
    //   num: 1,
    //   likes: ["eat", "sleep"]
    // }
    // const keys = Object.keys(obj);
    // console.log(keys);
    // Object.keys(obj).forEach(item => {
    //   console.log(obj[item]);
    // })
    // const values = Object.values(obj);
    // console.log(values);
    // const entries = Object.entries(obj);
    // console.log(entries);







    const arr = ["a", "b", "c", "d"];
    console.log(arr.join("$"));
    
  </script>
</body>
</html>